﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
      <div class="page page-current">
        <header class="bar bar-nav fs-header-small">
          <a href="${ctx.host}/profile" class="icon icon-left pull-left back"></a>
          <h1 class="title">我的订单</h1>
        </header>
        
        <div class="bar bar-header-secondary  bar-tab order-bar">
           <a class="tab-item order external fs-tab ${paymentStatus.unpaid ? 'active' : ''}" href="${ctx.host}/orders?paymentStatus=unpaid">未支付</a>
           <a class="tab-item order external fs-tab ${paymentStatus.paid ? 'active' : ''}" href="${ctx.host}/orders?paymentStatus=paid">已支付</a>
        </div>
        
        <div class="content" style="bottom: 0px; top: 4rem;">
          <div class="list-block media-list" style="margin-top:1.2rem; margin-bottom: 0px;">
            <c:choose>
              <c:when test="${not empty orders}">
                <ul>
                  <c:forEach var="order" items="${orders}">
                    <li>
                    <a href="${ctx.host}/orders/${order.id}" class="item-link item-content">
                      <div class="item-media"><img src="${cloud.prod}/${order.product.cover}" style='width: 4rem;'></div>
                      <div class="item-inner">
                        <div class="item-title-row">
                          <div class="item-title">${order.product.name}</div>
                        </div>
                        <div class="item-subtitle">支付时间：<fmt:formatDate value="${order.payTime}" pattern="yyyy-MM-dd" /></div>
                        <div class="item-text">
                          <p style="margin: 0px;">订单号: ${order.code}</p>
                          <p style="margin: 0px;">金额：${order.price / 100}</p>
                        </div>
                      </div>
                    </a>
                  </li>
                  </c:forEach>
                </ul>
              </c:when>
              <c:otherwise>
                <p class="text-center" style="color: #999;">暂无订单</p>
              </c:otherwise>
            </c:choose>
          </div>
        </div>
        
      </div>
    </div>
    
    <%@ include file="/WEB-INF/include/script.jsp"%>
    
  </body>
</html>